package com.dsbj.mp.icardservice.utils.jwt;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @version 2017-10-27
 */
@Configuration
public class JwtTokenUtil {
	
	@Value("${jwt.expire}")
	private int expire;
	@Value("${jwt.pri-key.path}")
	private String priKeyPath;
	@Value("${jwt.pub-key.path}")
	private String pubKeyPath;
	
	public String generateToken(IJWTInfo jwtInfo) throws Exception {
		return JWTHelper.generateToken(jwtInfo, priKeyPath, expire);
	}
	
	public IJWTInfo getInfoFromToken(String token) throws Exception {
		return JWTHelper.getInfoFromToken(token, pubKeyPath);
	}
	
	
}
